package com.diors.game.engine.arpg.npc;

import java.util.concurrent.ConcurrentHashMap;

import org.apache.log4j.Logger;

import com.diors.game.engine.arpg.npc.entity.NpcEntity;

/**
 * Npc管理类
 * @author	darren.ouyang <ouyang.darren@gmail.com>
 * @date	2013-10-28
 * @version 1.0
 * @copyright Copyright (c) 2013, darren.ouyang
 */
public class NpcManager 
{
	
	static Logger log = Logger.getLogger(NpcManager.class);

	private final ConcurrentHashMap<Long, NpcEntity> map = new ConcurrentHashMap<Long, NpcEntity>();
	
	public void register (NpcEntity npc)
	{
		map.put(npc.getId(), npc);
	}
	
	public void unregister (long npcID)
	{
		map.remove(npcID);
	}
	
	public NpcEntity get (long npcID)
	{
		return map.get(npcID);
	}

	public boolean contains(long npcID)
	{
		return map.containsKey(npcID);
	}
}
